

function async mockOrders() {
    try {
        // 开始事务
        await connection.beginTransaction();
        // 假设有两个表的数据
        const shop_orders = [
          { userid: '01', address: '丰台区',money:'2000', agentid:4, contract: '1000000001', phone: '15212134582', state: 1, carryid: 1, remark: '备注信息' },
          { userid: '02', address: '海淀区',money:'2000', agentid:5, contract: '1000000001', phone: '15212134582', state: 2, carryid: 2, remark: '备注信息' },
          { userid: '03', address: '昌平区',money:'2000', agentid:6, contract: '1000000001', phone: '15212134582', state: 3, carryid: 3, remark: '备注信息' },
          { userid: '04', address: '朝阳区',money:'2000', agentid:7, contract: '1000000001', phone: '15212134582', state: 4, carryid: 4, remark: '备注信息' },
          { userid: '05', address: '丰台区',money:'2000', agentid:4, contract: '1000000001', phone: '15212134582', state: 1, carryid: 5, remark: '备注信息' },
          { userid: '06', address: '丰台区',money:'2000', agentid:4, contract: '1000000001', phone: '15212134582', state: 3, carryid: 6, remark: '备注信息' },
          // 更多行...
        ];
        const shop_orders_flow = [{
            orderid: 1, prestate: 1, state: 2, operator: '1000000001', remark: '备注信息'
        }, {
            orderid: 2, prestate: 2, state: 3, operator: '1000000001', remark: '备注信息'
        }, {
            orderid: 3, prestate: 3, state: 4, operator: '1000000001', remark: '备注信息'
        }, {
            orderid: 4, prestate: 4, state: 5, operator: '1000000001', remark: '备注信息'
        }, {
            orderid: 5, prestate: 5, state: 6, operator: '1000000001', remark: '备注信息'
        }]
        // 批量插入第一个表
        const insertQuery1 = 'INSERT INTO shop_orders (userid,address,money,agentid,contract,phone,state,carryid,remark) VALUES ?';
        await connection.query(insertQuery1, [shop_orders.map(row => [row.userid, row.address,row.money, row.agentid,row.phone,row.state,row.carryid,row.remark])]);
     
        // 批量插入第二个表
        const insertQuery2 = 'INSERT INTO shop_orders_flow (orderid,prestate,state,operator,remark) VALUES ?';
        const values = shop_orders_flow.map(row => [row.orderid, row.prestate, row.state, row.operator, row.remark]);
        await connection.query(insertQuery2, [values]);
     
        // 提交事务
        await connection.commit();
      } catch (err) {
        // 有错误时回滚
        await connection.rollback();
        throw err;
      }
}